require File.join(File.dirname(__FILE__), '../message')

class TestMessage < Test::Unit::TestCase
   
   def setup
      @message = Message.new(1, Clock.new(5), "This is a test")
   end
   
   def teardown
      # Nothing really
   end
   
   def test_simple
      assert_equal("This is a test", @message.content)
      assert_equal(1, @message.processId)
      assert_equal(Clock.new(5), @message.clock)
   end
   
   def test_typecheck
      assert_raise( RuntimeError ) { Message.new("1", Clock.new(1), "") }
      assert_raise( RuntimeError ) { Message.new(1, "[1, 2, 3]", "") }
      assert_raise( RuntimeError ) { Message.new(1, Clock.new(1), 258) }
   end
  
end 
